double y);
GDK_AVAILABLE_IN_3_94
const PangoFont * gsk_text_node_peek_font (GskRenderNode *node);
-GDK_AVAILABLE_IN_3_94
-const PangoGlyphString *gsk_text_node_peek_glyphs (GskRenderNode *node);
+GDK_AVAILABLE_IN_3_94
+guint gsk_text_node_get_num_glyphs (GskRenderNode *node);
+GDK_AVAILABLE_IN_3_94
+const PangoGlyphInfo *gsk_text_node_peek_glyphs (GskRenderNode *node);
GDK_AVAILABLE_IN_3_94
const GdkRGBA * gsk_text_node_peek_color (GskRenderNode *node);
GDK_AVAILABLE_IN_3_94
GskRenderNode render_node;
PangoFont *font;
- PangoGlyphString *glyphs;
GdkRGBA color;
double x;
double y;
+
+ guint num_glyphs;
+ PangoGlyphInfo glyphs[];
};
static void
GskTextNode *self = (GskTextNode *) node;
g_object_unref (self->font);
- pango_glyph_string_free (self->glyphs);
}
#ifndef STACK_BUFFER_SIZE
cairo_set_scaled_font (cr, scaled_font);
gdk_cairo_set_source_rgba (cr, &self->color);
- if (self->glyphs->num_glyphs > (int) G_N_ELEMENTS (stack_glyphs))
- cairo_glyphs = g_new (cairo_glyph_t, self->glyphs->num_glyphs);
+ if (self->num_glyphs > (int) G_N_ELEMENTS (stack_glyphs))
+ cairo_glyphs = g_new (cairo_glyph_t, self->num_glyphs);
else
cairo_glyphs = stack_glyphs;
count = 0;
- for (i = 0; i < self->glyphs->num_glyphs; i++)
+ for (i = 0; i < self->num_glyphs; i++)
{
- PangoGlyphInfo *gi = &self->glyphs->glyphs[i];
+ PangoGlyphInfo *gi = &self->glyphs[i];
if (gi->glyph != PANGO_GLYPH_EMPTY)
{
s = pango_font_description_to_string (desc);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(uiiii)"));
- for (i = 0; i < self->glyphs->num_glyphs; i++)
+ for (i = 0; i < self->num_glyphs; i++)
{
- PangoGlyphInfo *glyph = &self->glyphs->glyphs[i];
+ PangoGlyphInfo *glyph = &self->glyphs[i];
g_variant_builder_add (&builder, "(uiiii)",
glyph->glyph,
glyph->geometry.width,
if (ink_rect.width == 0 || ink_rect.height == 0)
return NULL;
- self = (GskTextNode *) gsk_render_node_new (&GSK_TEXT_NODE_CLASS, 0);
+ self = (GskTextNode *) gsk_render_node_new (&GSK_TEXT_NODE_CLASS, sizeof (PangoGlyphInfo) * glyphs->num_glyphs);
self->font = g_object_ref (font);
- self->glyphs = pango_glyph_string_copy (glyphs);
self->color = *color;
self->x = x;
self->y = y;
+ self->num_glyphs = glyphs->num_glyphs;
+ memcpy (self->glyphs, glyphs->glyphs, sizeof (PangoGlyphInfo) * glyphs->num_glyphs);
graphene_rect_init (&self->render_node.bounds,
x,
return self->font;
}
-const PangoGlyphString *
+guint
+gsk_text_node_get_num_glyphs (GskRenderNode *node)
+{
+ GskTextNode *self = (GskTextNode *) node;
+
+ g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXT_NODE), 0);
+
+ return self->num_glyphs;
+}
+
+const PangoGlyphInfo *
gsk_text_node_peek_glyphs (GskRenderNode *node)
{
GskTextNode *self = (GskTextNode *) node;
GskVulkanRenderer *renderer,
const graphene_rect_t *rect,
PangoFont *font,
- PangoGlyphString *glyphs,
+ guint total_glyphs,
+ const PangoGlyphInfo *glyphs,
float x,
float y,
guint start_glyph,
int x_position = 0;
for (i = 0; i < start_glyph; i++)
- x_position += glyphs->glyphs[i].geometry.width;
+ x_position += glyphs[i].geometry.width;
- for (; i < glyphs->num_glyphs && count < num_glyphs; i++)
+ for (; i < total_glyphs && count < num_glyphs; i++)
{
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ const PangoGlyphInfo *gi = &glyphs[i];
if (gi->glyph != PANGO_GLYPH_EMPTY)
{
GskVulkanRenderer *renderer,
const graphene_rect_t *rect,
PangoFont *font,
- PangoGlyphString *glyphs,
+ guint total_glyphs,
+ const PangoGlyphInfo *glyphs,
float x,
float y,
guint start_glyph,
case GSK_TEXT_NODE:
{
const PangoFont *font = gsk_text_node_peek_font (node);
- const PangoGlyphString *glyphs = gsk_text_node_peek_glyphs (node);
+ const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node);
+ guint num_glyphs = gsk_text_node_get_num_glyphs (node);
int i;
guint count;
guint texture_index;
op.text.start_glyph = 0;
op.text.texture_index = G_MAXUINT;
- for (i = 0, count = 0; i < glyphs->num_glyphs; i++)
+ for (i = 0, count = 0; i < num_glyphs; i++)
{
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ const PangoGlyphInfo *gi = &glyphs[i];
if (gi->glyph != PANGO_GLYPH_EMPTY && !(gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG))
{
GSK_VULKAN_RENDERER (gsk_vulkan_render_get_renderer (render)),
&op->text.node->bounds,
(PangoFont *)gsk_text_node_peek_font (op->text.node),
- (PangoGlyphString *)gsk_text_node_peek_glyphs (op->text.node),
+ gsk_text_node_get_num_glyphs (op->text.node),
+ gsk_text_node_peek_glyphs (op->text.node),
gsk_text_node_peek_color (op->text.node),
gsk_text_node_get_x (op->text.node),
gsk_text_node_get_y (op->text.node),
GSK_VULKAN_RENDERER (gsk_vulkan_render_get_renderer (render)),
&op->text.node->bounds,
(PangoFont *)gsk_text_node_peek_font (op->text.node),
- (PangoGlyphString *)gsk_text_node_peek_glyphs (op->text.node),
+ gsk_text_node_get_num_glyphs (op->text.node),
+ gsk_text_node_peek_glyphs (op->text.node),
gsk_text_node_get_x (op->text.node),
gsk_text_node_get_y (op->text.node),
op->text.start_glyph,
GskVulkanRenderer *renderer,
const graphene_rect_t *rect,
PangoFont *font,
- PangoGlyphString *glyphs,
+ guint total_glyphs,
+ const PangoGlyphInfo *glyphs,
const GdkRGBA *color,
float x,
float y,
int x_position = 0;
for (i = 0; i < start_glyph; i++)
- x_position += glyphs->glyphs[i].geometry.width;
+ x_position += glyphs[i].geometry.width;
- for (; i < glyphs->num_glyphs && count < num_glyphs; i++)
+ for (; i < total_glyphs && count < num_glyphs; i++)
{
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ const PangoGlyphInfo *gi = &glyphs[i];
if (gi->glyph != PANGO_GLYPH_EMPTY)
{
GskVulkanRenderer *renderer,
const graphene_rect_t *rect,
PangoFont *font,
- PangoGlyphString *glyphs,
+ guint total_glyphs,
+ const PangoGlyphInfo *glyphs,
const GdkRGBA *color,
float x,
float y,
case GSK_TEXT_NODE:
{
const PangoFont *font = gsk_text_node_peek_font (node);
- const PangoGlyphString *glyphs = gsk_text_node_peek_glyphs (node);
+ const PangoGlyphInfo *glyphs = gsk_text_node_peek_glyphs (node);
const GdkRGBA *color = gsk_text_node_peek_color (node);
+ guint num_glyphs = gsk_text_node_get_num_glyphs (node);
float x = gsk_text_node_get_x (node);
float y = gsk_text_node_get_y (node);
PangoFontDescription *desc;
g_free (tmp);
pango_font_description_free (desc);
- s = g_string_sized_new (6 * glyphs->num_glyphs);
- for (i = 0; i < glyphs->num_glyphs; i++)
- g_string_append_printf (s, "%x ", glyphs->glyphs[i].glyph);
+ s = g_string_sized_new (6 * num_glyphs);
+ for (i = 0; i < num_glyphs; i++)
+ g_string_append_printf (s, "%x ", glyphs[i].glyph);
add_text_row (store, "Glyphs", s->str);
g_string_free (s, TRUE);